﻿using System;
using System.ComponentModel.DataAnnotations;
using ServiceStack.DataAnnotations;

namespace NetSurveillance.WebApp.DataServices.Models
{
    [Serializable]
    [Alias("WebAppUsers")]
    public class User : BaseModel
    {
        [AutoIncrement]
        public long Id { get; set; }

        [Required]
        [StringLength(30)]
        [Index(Unique = true)]
        public string UserName { get; set; }

        [Required]
        [StringLength(200)]
        public string Password { get; set; }

        [Default(typeof(int), "1")]
        public UserType UserType { get; set; }

        [StringLength(64)]
        public string RealName { get; set; }

        [StringLength(120)]
        public string Email { get; set; }

        [StringLength(32)]
        public string Phone { get; set; }

        [Ignore]
        public UserPermission UserPermission { get; set; }
    }

    public enum UserType
    {
        Administrator = 0,
        Normal = 1,
    }
}